package com.cheney.weiboo.view;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.TabHost;
import android.widget.TextView;

import com.cheney.weiboo.R;

public class MainActivity  extends TabActivity{
	private TabHost tabHost;
	private RadioGroup radioGroup;
	private static final String HOME = "主页";
	private static final String REFER = "提及";
	private static final String SECRET = "私信";
	private static final String SEARCH = "搜索";
	private static final String ATTENTION = "关注";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tabhost);
		tabHost = this.getTabHost();
		//1.
        View home = View.inflate(this, R.layout.tab, null);
       ((ImageView)home.findViewById(R.id.tabImage)).setImageResource(R.drawable.tab_timeline_selector);
        ((TextView)home.findViewById(R.id.tabName)).setText(HOME);
        
        TabHost.TabSpec spec1 = tabHost.newTabSpec(HOME);
        spec1.setIndicator(home);
        spec1.setContent(new Intent(this,HomeTimeLineActivity.class));
        tabHost.addTab(spec1);
        //2.
        View reffer = View.inflate(this, R.layout.tab, null);
        ((ImageView)reffer.findViewById(R.id.tabImage)).setImageResource(R.drawable.tab_atme_selector);
        ((TextView)reffer.findViewById(R.id.tabName)).setText(REFER);
        
        TabHost.TabSpec spec2 = tabHost.newTabSpec(REFER);
        spec2.setIndicator(reffer);
        spec2.setContent(new Intent(this,HomeActivity.class));
        tabHost.addTab(spec2);
        //3.
        View secret = View.inflate(this,R.layout.tab, null);
        ((ImageView)secret.findViewById(R.id.tabImage)).setImageResource(R.drawable.tab_message_selector);
        ((TextView)secret.findViewById(R.id.tabName)).setText(SECRET);
        
        TabHost.TabSpec spec3 = tabHost.newTabSpec(SECRET);
        spec3.setIndicator(secret);
        spec3.setContent(new Intent(this,HomeActivity.class));
        tabHost.addTab(spec3);
        
        //4.
        View search = View.inflate(this,R.layout.tab, null);
        ((ImageView)search.findViewById(R.id.tabImage)).setImageResource(R.drawable.tab_explore_selector);
        ((TextView)search.findViewById(R.id.tabName)).setText(SEARCH);
        
        TabHost.TabSpec spec4 = tabHost.newTabSpec(SEARCH);
        spec4.setIndicator(search);
        spec4.setContent(new Intent(this,HomeActivity.class));
        tabHost.addTab(spec4);
        //5.
        View attention = View.inflate(this,R.layout.tab, null);
        ((ImageView)attention.findViewById(R.id.tabImage)).setImageResource(R.drawable.tab_focus_selector);
        ((TextView)attention.findViewById(R.id.tabName)).setText(ATTENTION);
        
        
        TabHost.TabSpec spec5 = tabHost.newTabSpec(ATTENTION);
        spec5.setIndicator(attention);
        spec5.setContent(new Intent(this,HomeActivity.class));
        tabHost.addTab(spec5);
        
        tabHost.setCurrentTab(0);
	}
}
